package com.example.springbootredis.utils;

import java.time.Instant;
import java.util.*;
import java.util.regex.Pattern;


public class Tool {

    //当前时间戳
    public static int getCurrentTime() {
        return (int) Instant.now().getEpochSecond();
    }

    //uuid生成
    public static UUID getUUID() {
        return UUID.randomUUID();
    }

    //手机号码格式检查
    public static Boolean isMobile(String mobile) {
        String mobileRule = "^1[3-9]\\d{9}$";
        return Pattern.matches(mobileRule, mobile);
    }

    //密码格式验证
    public static Boolean isPassword(String password) {
        String passwordRule = "^(?=.*[^\\d]).{8,}$";
        return Pattern.matches(passwordRule, password);
    }


}
